<div style="padding-bottom: 16px">
  <span style="margin-right: 8px;">
    <button nz-button nzType="primary" (click)="getMainData(pageSize, 1, {})">
      <i nz-icon nzType="fullscreen" nzTheme="outline"></i>
      <span>全部</span>
    </button>
  </span>
  <span style="margin-right: 8px;">
    <app-repairform btnType="primary">
      <i nz-icon nzType="pic-left" nzTheme="outline"></i>&nbsp;
      <span>新增申请</span>
    </app-repairform>
  </span>
  <a nz-button nzType="primary" nzPlacement="right" nz-popconfirm nzCancelText="取消" nzOkText="确定"
    [nzTitle]="'确定要删除这'+selectedDataLen+'条数据吗?'" [nzCondition]="!(allChecked || indeterminate)"
    (nzOnConfirm)="delMaterials()">
    <i nz-icon nzType="delete" nzTheme="outline"></i>
    <span>删除</span>
  </a>
</div>
<nz-spin nzSize="large" [nzSpinning]="loadingData" [nzDelay]="200">
  <nz-table nzSize="small" nzBordered nzShowSizeChanger [nzData]="displayData" [nzFrontPagination]="false"
    [nzFooter]="itemsTotal&&'总共 '+ itemsTotal +' 条数据'" [nzTotal]="itemsTotal" [(nzPageIndex)]="pageIndex"
    (nzPageIndexChange)="getMainData(pageSize, pageIndex, params)" [(nzPageSize)]="pageSize"
    (nzPageSizeChange)="getMainData(pageSize, 1, {})" [nzShowQuickJumper]="itemsTotal>50">
    <thead>
      <tr>
        <th nzAlign="center" nzWidth="2%" nzShowCheckbox [nzIndeterminate]="indeterminate" [(nzChecked)]="allChecked"
          (nzCheckedChange)="checkAll($event)"></th>
        <th nzAlign="center">序号</th>
        <th nzAlign="center" nzCustomFilter>文号
          <app-goods-search [searchKey]="searchKeys[0]" [pageSize]="oldSize" [isGetAll]="isGetAll"
            (loadingState)="getState($event)" (returnParams)="getMainData(pageSize,1,$event)"></app-goods-search>
        </th>
        <th nzAlign="center">操作部门</th>
        <th nzAlign="center">操作人</th>
        <th nzAlign="center" nzCustomFilter>操作时间
          <app-date-filter [pageSize]="oldSize" [isGetAll]="isGetAll" (loadingState)="getState($event)"
            (returnParams)="getMainData(pageSize,1,$event)"></app-date-filter>
        </th>
        <th nzAlign="center">文件</th>
        <th nzAlign="center">下载</th>
        <th nzAlign="center">上传</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of displayData;let i = index">
        <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="refreshStatus()"></td>
        <td nzAlign="center">{{ +i + 1 }}</td>
        <td nzAlign="center">
          <app-repairform btnType="default" [apiIdentity]="apiIdentity" [readOnly]="true" [queryId]=data?.id>
            <span>昆明南{{ data.no }}号</span>
          </app-repairform>
        </td>
        <td nzAlign="center">{{ data?.operOrg }}</td>
        <td nzAlign="center">{{ data?.operUser }}</td>
        <td nzAlign="center">{{ data?.operTime }}</td>
        <td>
          <ng-container *ngIf="data.fileUrl">
            <div style="display: flex;justify-content: space-between;">
              <a [href]="baseUrl + data.fileUrl" target="_blank">{{ data?.fileName }}</a>
              <button nz-popconfirm nz-button nzTitle="确定要删除这个文件吗?" nzPlacement="top" (nzOnConfirm)="delFile(data?.id)">
                <i nz-icon nzType="delete" nzTheme="twotone"></i>
              </button>
            </div>
          </ng-container>
        </td>
        <td nzAlign="center">
          <ng-container *ngIf="data.fileUrl">
            <a nz-popconfirm nzCondition class="mr-sm" down-file http-data [http-url]="baseUrl + data.fileUrl"
              [file-name]="data.fileName">
              <i nz-icon nzType="vertical-align-bottom" nzTheme="outline"></i>
              <span>下载</span>
            </a>
          </ng-container>
        </td>
        <td nzAlign="center">
          <nz-upload [nzAction]="apiAddress" (nzChange)="handleChange($event)" [nzCustomRequest]="customReq"
            [nzShowUploadList]="false">
            <button nz-button (click)="currId=data?.id">
              <i nz-icon nzType="upload"></i><span>浏览……</span>
            </button>
          </nz-upload>
        </td>
      </tr>
    </tbody>
  </nz-table>
</nz-spin>